package com.adcc.loadsheet.billing.util;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.List;
import java.util.Map;

/**
 * Created by zhaoml on 2020/9/24.
 */
public class BillingTools {

    //获取两个List的差集
    public static Map<String,String> getDifference(List<String> list1,List<String> list2){
        Map<String,String> res = Maps.newHashMap();

        List<String> list1_copy = Lists.newArrayList();
        list1_copy.addAll(list1);

        //去差
        list1.removeAll(list2);
        list2.removeAll(list1_copy);

        res.put("less",String.join(",", list1));
        res.put("more",String.join(",", list2));

        return res;
    }
}